/**  
 * 
 * @Title:  DefaultChannelPoolHandler.java   
 * @Package com.org.framework.net.pool   
 * @Description:    TODO(用一句话描述该文件做什么)   
 * @author: 123774135@qq.com     
 * @date:   2018年7月5日 下午6:31:53   
 * @version V1.0 
 * @Copyright: 2018 www.tydic.com Inc. All rights reserved. 
 * 
 */  
package com.bicon.base.data.common.net.pool;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.pool.ChannelPoolHandler;
import io.netty.channel.socket.nio.NioSocketChannel;

/**   
 * @ClassName:  DefaultChannelPoolHandler   
 * @Description:具体的业务处理   
 * @author: 123774135@qq.com 
 * @date:   2018年7月5日 下午6:31:53   
 *     
 * @Copyright: 2018 
 * 
 */
public abstract class AbstarctDefaultChannelPoolHandler implements ChannelPoolHandler{

	private Logger logger = LoggerFactory.getLogger(AbstarctDefaultChannelPoolHandler.class);
	
	@Override
	public void channelReleased(Channel ch) throws Exception {
		ch.writeAndFlush(Unpooled.EMPTY_BUFFER);//flush掉所有写回的数据  
		
	}

	@Override
	public void channelAcquired(Channel ch) throws Exception {
		//logger.info("222222222222222channelReleased");
		
	}

	@Override
	public void channelCreated(Channel ch) throws Exception {
		NioSocketChannel channel  = (NioSocketChannel) ch;
		doHander(channel);
		
	}
	
	public abstract void doHander(NioSocketChannel ch);

}
